﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace TimerTask.Model.Common
{
    public class Pager<T> :Pager
    {
        public List<T> Data { get; set; }
        /// <summary>
        /// 构造分页对象
        /// </summary>
        /// <param name="total">总条数</param>
        /// <param name="pageSize">页数</param>
        /// <param name="index">当前页</param>
        /// <param name="data">内容</param>
        public Pager(int total, int pageSize, int index, List<T> data)
        {
            TotalCount = total;
            PageSize = pageSize;
            Index = index;
            Data = data;
            TotalPage = (int)Math.Ceiling(TotalCount / (pageSize * 1.0));
        }
    }

    public class Pager 
    {
        public int TotalCount { get; set; }
        public int PageSize { get; set; }
        public int Index { get; set; }
        public int TotalPage { get; set; }

    }
}
